﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lifetime : MonoBehaviour
{
    public float duration = 3f;

    private float t_start;
    // Start is called before the first frame update
    void Start()
    {
        t_start = Time.time;
    }

    // Update is called once per frame
    void Update()
    {
        if (Time.time - t_start >= duration)
        {
            Destroy(gameObject);
        }
    }
}
